#include<iostream>
#include<string>
#include<stack>

using namespace std;

int main(){
	stack<char> st;
	string s;
	cin>>s;
	for(char c:s){
		if (c=='('|| c=='['){
			st.push(c);
		}else{
			if(st.empty()){
				cout<<"No"<<endl;
				return 0;
			}
			if( (st.top()=='(' && c==']') || (st.top()=='[' && c==')')){
				cout<<"No"<<endl;
				return 0;
			}
			st.pop();
		}
	}
	
	if(st.empty()){
		cout<<"Yes"<<endl;
		return 0;
	}
	
	cout<<"No"<<endl;
	return 0;
}
